<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/WEB-INF/template/basicTemplate.xhtml">
<ui:define name="content">
	<h:inputHidden rendered="#{menuController.userRank != 1}" value="#{menuController.redirect()}"></h:inputHidden>
	<h:inputHidden value="#{menuController.setUrl(request.requestURL)}"></h:inputHidden>
	<h:inputHidden rendered="#{menuController.userRank == 1}">
	<h:dataTable binding="#{viewCandidatesBean.mainTable}" value="#{viewCandidatesBean.candidates}" var="c" styleClass="testertable" >
		
		<h:column>
			<f:facet name="header">
    				Name
    			</f:facet>
    			<h:form>
    			 <h:commandLink  disabled="false" styleClass="link" action="#{viewCandidatesBean.showCandidate}"> 	#{c.name}
    			 <f:setPropertyActionListener target="#{viewCandidatesBean.candidate}" value="#{c}" />
    			 </h:commandLink>
    			 </h:form>
    		</h:column>

		<h:column>
			<f:facet name="header">
    				Tests
				</f:facet>
			<h:dataTable value="#{c.interviews}" var="test"  binding="#{viewCandidatesBean.testNameTable}"
				styleClass="inner-table"  border="0" >
				<h:column >
				<h:form>
				#{test.template.title}  <h:commandLink rendered="#{test.taken}" styleClass="link"  action="#{viewCandidatesBean.detailTest}"> View Test</h:commandLink>
				</h:form>
				</h:column>
			</h:dataTable>
			<h:form>
			<h:commandButton styleClass="button" value="Add Interview" action="#{viewCandidatesBean.addTest}" />
			</h:form>		
		</h:column>
	
		<h:column>
			<f:facet name="header">
    				Inform Candidate
				</f:facet>
			<h:dataTable binding="#{viewCandidatesBean.dataTable}" value="#{c.interviews}" var="test"
				styleClass="inner-table"  border="0" >
				<h:column>			
					<h:form>

						<h:commandButton  value="Send Email"
							disabled="#{test.send}"
							styleClass="#{test.butSend}"	

							action="#{viewCandidatesBean.sendEmail}" >
							 <f:setPropertyActionListener target="#{viewCandidatesBean.test}" value="#{test}" />
							 </h:commandButton>
					</h:form>
					<h:form>		

						<h:commandButton  value="View" styleClass="#{test.butView}"

							disabled="#{test.view}"
							 action="#{viewCandidatesBean.view}" >
							 <f:setPropertyActionListener target="#{viewCandidatesBean.test}" value="#{test}" />
							</h:commandButton>
					</h:form>
					<h:form>

						<h:commandButton value="Delete"
							disabled="#{test.delete}"
							onclick="/faces/testerhome.xhtml"
							styleClass="#{test.butDel}"
							action="#{viewCandidatesBean.delete}"  >
							 <f:setPropertyActionListener target="#{viewCandidatesBean.test}" value="#{test}" />
							 </h:commandButton>
					</h:form>
					
				</h:column>
			</h:dataTable>
		</h:column>

		<h:column>
			<f:facet name="header">	Confirmed</f:facet>
			<h:dataTable value="#{c.interviews}" var="test"
				styleClass="inner-table"  border="0" >
				<h:column>#{test.accepted}</h:column>
			</h:dataTable>
		</h:column>

	</h:dataTable>
	</h:inputHidden>
	</ui:define>
</ui:composition>
</html>